package com.fjb.controller.order;


import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fjb.common.entity.HttpCode;
import com.fjb.common.entity.JsonResult;
import com.fjb.controller.base.BaseController;
import com.fjb.service.order.OrderInfoService;

/**
 * <p>
 * 订单信息 前端控制器
 * </p>
 *
 * @author hemiao
 * @since 2019-12-22
 */
@Controller
@RequestMapping("/orderInfo")
public class OrderInfoController extends BaseController{
	
	@Autowired
	private OrderInfoService orderInfoService;
	
	// 添加订单
	@RequestMapping(value="/addInfo")
	@ResponseBody
	public JsonResult<Boolean> addInfo(HttpServletRequest request){
		HttpCode httpCode = HttpCode.PARAM_VERIFICATION;
		String cartIds = request.getParameter("cartIds");
		if(StringUtils.isBlank(cartIds)) {	
			return new JsonResult<Boolean>(null, httpCode);
		}
		List<Integer> cartIdList = new ArrayList<Integer>();
		String[] cartIdsAry = cartIds.split(",");
		for (int i = 0; i < cartIdsAry.length; i++) {
			String cartId = cartIdsAry[i];
			cartIdList.add(Integer.valueOf(cartId));
		}
		
		return new JsonResult<Boolean>(null, HttpCode.SUCCESS);
	}
	
}
